package com.wzw.springboot.principle.lifecycle.bean;

/**
 * 注解内指定初始化与销毁方法
 * @author Wangzhiwen
 */
public class Bean1 {
    private String name;
    private int age;

    public void bean1Init(){
        System.out.println("bean1 spring @Bean(initMethod='bean1Init') 初始化...........");
    }

    public void beanDestroy(){
        System.out.println("bean1 spring @Bean(destroyMethod='beanDestroy') 销毁");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Bean1{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

}
